package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;

/**
 * @author Evad.Wu
 * @Description 爱企查-主要人员信息 映射
 * @date 2022-09-23
 */
@Setter
@Getter
@ToString(exclude = "aiqichaHeaderPo")
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_DIRECTORS")

@Entity
@Table(name = "AIQICHA_DIRECTORS")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-主要人员信息 映射")
public class AiqichaDirectorsPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 3184132396711507392L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "主要人员ID")
    @TableField(value = "PERSON_ID")
    @Column(name = "PERSON_ID", columnDefinition = "VARCHAR(64) NOT NULL COMMENT '主要人员ID'")
    private String personId;
    @Schema(description = "主要人员姓名")
    @TableField(value = "NAME")
    @Column(name = "NAME", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '主要人员姓名'")
    private String name;
    @Schema(description = "职位")
    @TableField(value = "TITLE")
    @Column(name = "TITLE", columnDefinition = "VARCHAR(16) COMMENT '职位'")
    private String title;
    @Schema(description = "性别")
    @TableField(value = "GENDER")
    @Column(name = "GENDER", columnDefinition = "VARCHAR(4) COMMENT '性别'")
    private String gender;
    @Schema(description = "主要人员主页链接（前缀：https://aiqicha.baidu.com）")
    @TableField(value = "PERSON_LINK")
    @Column(name = "PERSON_LINK", columnDefinition = "TEXT(65,535) COMMENT '主要人员主页链接（前缀：https://aiqicha.baidu.com）'")
    private String personLink;

    @Schema(description = "基本信息")
    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "PID", referencedColumnName = "PID", insertable = false, updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
